<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/js/kindeditor-all-min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/zh_CN.js"></script>
<link rel="stylesheet" href="__PUBLIC__/css/kindeditor.css" type="text/css" />
<script type="text/javascript">
	<if condition="C('ismobile') neq 1">
		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="content"]', {
				uploadJson:'{:U("file/editor")}',
				allowFileManager : true,
				loadStyleMode : false,
				fileManagerJson: "{:U('file/manager')}"
			});
		});
	</if>
</script>
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header">
		<h4>{:L('ADD_KNOWLEDGE')}</h4>
	</div>
	<div class="row">
		<div class="span12">
			<include file="Public:alert" />
			<form action="{:U('knowledge/add')}" method="post">
				<input  type="hidden" name="role_id" value="{$Think.session.role_id}"/>
				<table class="table" border="0" cellspacing="1" cellpadding="0">
					<thead>
						<tr>
							<td colspan="2"><input name="submit" class="btn btn-primary" type="submit" value="{:L('SAVE')}"/>&nbsp; <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE AND NEW')}"/> &nbsp;<input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/></td>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="2"><input class="btn btn-primary"  name="submit" type="submit" value="{:L('SAVE')}"/> &nbsp;<input class="btn btn-primary" type="submit" value="{:L('SAVE AND NEW')}"/>&nbsp; <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/></td>
						</tr>
					</tfoot>
					<tbody>
						<th colspan="2">{:L('BASIC_INFO')}</th>
						<tr>
							<td class="tdleft">{:L('TITLE')}</td>
							<td><input class="span3" type="text" name="title" id="title" placeholder="{:L('ENTER_TITLE')}"></td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CATEGORY')}</td>
							<td>
								<select name="category_id">
									<volist  name="category_list" id="vo">
									<option value="{$vo.category_id}">{$vo.name}</option>
									</volist>
								</select>
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CONTENT')}</td>
							<td>
								<textarea name="content" id="content" style="width: 800px; height: 350px;"></textarea>
							</td>
						</tr>
					</tbody>
				</table>
			</form>

		</div>
	</div>
</div>
<script type="text/javascript">
	<if condition="C('ismobile') eq 1">
		width=$('.container').width() * 0.9;
		$("#content").css({
			width : width
		});
	</if>
	$("input[name='submit']").click(function(){			
		if($("#title").val() == null || $("#title").val() == ""){
			alert('{:L('CONTENT_CAN_NOT_EMPTY')}');
			return false;
		}
	})
</script>
<include file="Public:footer" />